﻿<?
include("../Comm/Manage_err.php");
include("../Comm/Conn.php");
include("../Comm/HtmlEdit.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netsys网站管理系统</title>
<link href="../Style/Css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function Check()
{
  if (document.MyForm.NTitle.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.NTitle.focus()
      return false
   }
  if (document.MyForm.ClassID.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.ClassID.focus()
      return false
   }
     if (document.MyForm.Uppic.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.Uppic.focus()
      return false
   }
}
</script>
</head>
<body>
<?
if($_POST['Edit']){
if($_POST['NHome']==1){
$NHome=1;
}else{
$NHome=0;
}
     	$sql="update Netsys_Product set"
		." NTitle='".$_POST[NTitle]."',"
		." Uppic='".$_POST[Uppic]."',"
		." NIntro='".$_POST[NIntro]."',"
		." ClassID='".$_POST[ClassID]."',"
		." NContent='".$_POST[NContent]."',"
		." NTime='".date('Y-m-d')."',"
		." NHome='".$NHome."'"
		." where NID=".htmlencode($_POST[NID])."" ;
		$query=mysql_query($sql);
		echo "<script language='javascript'>"; 
        echo "alert('产品修改成功！');";
        echo " location='Netsys_List.php';"; 
        echo "</script>";
}

		     $SQL="SELECT * FROM Netsys_Product where NID=".htmlencode($_GET[NID])."";
             $query=mysql_query($SQL);
			 $num=mysql_num_rows($query);
			 if($num==0){
			 echo "没有这条记录";
             echo "<br/>";
             echo "<a href='javascript:history.go(-1)'>返回上一页！</a>";
			 }
else
{
             $row=mysql_fetch_array($query)
?>

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10"></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="right_tittle">
  <tr>
    <td width="3"><img src="../images/r1.jpg" width="10" height="33" /></td>
    <td><img src="../images/current.jpg" width="9" height="9" /> 当前位置 &gt;&gt; 产品展示 | 编辑产品展示</td>
    <td width="10" align="right"><img src="../images/r3.jpg" width="10" height="33" /></td>
  </tr>
</table>
  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2" class="right_con">
    <tr>
      <td height="490" align="center" valign="top" bgcolor="#FFFFFF">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="5"></td>
        </tr>
      </table>
      <br />
        <form name="MyForm" action="" method="post">
        <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CDD8DF" class="table_all" >
          <tr>
            <td align="left" class="Left_td">标题：</td>
            <td align="left" class="Right_td"><input name="NTitle" type="text" id="NTitle" style="width:300px" value="<? echo $row['NTitle']; ?>">
                <font color="#ff0000">*</font> </td>
          </tr>
          <tr>
            <td width="19%" align="left" class="Left_td">简介：</td>
            <td width="81%" align="left" class="Right_td"><textarea name="NIntro" id="NIntro" cols="60" rows="3"><? echo $row['NIntro']; ?></textarea></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">图标：</td>
            <td align="left" class="Right_td"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td id="showpic" style="display:
				  <?
				  if($row['Uppic']!=""){
				  echo "block;";
				  }else{
				  echo "none;";
				  }
				  ?>
				  ">
				  						 <?
				  if($row['Uppic']!=""){
				  ?>
				  <table width="100%" border="0" cellpadding="0" cellspacing="0">
					  <tr>
                        <td valign="middle" width="21%" id="pic">
						<a href="../UploadImg/<? echo $row['Uppic']; ?>" target="_blank"><img src="../UploadImg/<? echo $row['Uppic']; ?>" name="image" width="120" height="50" border="0" id="image" onMouseOver="document.getElementById('bigPic').style.display=''" onMouseOut="document.getElementById('bigPic').style.display='none'"></a>
						<div id="bigPic" style="display:none; position:absolute;"><img src="../UploadImg/<? echo $row['Uppic']; ?>"></div>
						</td>
                        <td valign="middle"><a style="cursor:hand;" onClick="document.all.hidpic.style.display='';document.all.showpic.style.display='none';">&nbsp;&nbsp;更改图片</a>&nbsp;&nbsp; <a style="cursor:hand;" onClick="document.all.Uppic.value='';document.all.showpic.style.display='none';document.all.hidpic.style.display='';">删除图片</a> </td>
                      </tr>
                  </table>
<?
						}
						?>
				  </td>
                  <td id="hidpic" style="display:
				  <?
				  if($row['Uppic']!=""){
				  echo "none;";
				  }
				  ?>"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td id="hiddenframe"><a style="cursor:hand" onClick="document.all.showframe.style.display='';document.all.hiddenframe.style.display='none';">上传图片</a>&nbsp;&nbsp; <a style="cursor:hand" onClick="document.all.adddz.style.display='';document.all.hiddenframe.style.display='none';">插入图片URL</a>
                            <input name="Uppic" type="hidden" id="Uppic" value="<? echo $row['Uppic']; ?>">                        </td>
                      </tr>
                      <tr>
                        <td id="showframe" style="display:none"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td><table width="100%"  border="0" align="left" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="341" align="left"><iframe src="../Comm/upfileadd.php?up=../UploadImg/&tup=Uppic&FormName=MyForm" frameborder="0" height="20" width="400" scrolling="no" marginwidth="0" marginheight="0"></iframe></td>
                                    <td align="left">&nbsp;<a style="cursor:hand" onClick="document.all.showframe.style.display='none';document.all.hiddenframe.style.display='';">取消</a></td>
                                  </tr>
                              </table></td>
                            </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td height="17" id="adddz" style="display:none"><input name="dz" type="text" id="dz" onChange="document.all.Uppic.value=this.value" size="30" >
                          &nbsp; <a style="cursor:hand" onClick="document.all.adddz.style.display='none';document.all.hiddenframe.style.display='';">取消</a> </td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">类型：</td>
            <td align="left" class="Right_td"><select name="ClassID" id="ClassID">
                <option value="">请选择类型</option>
                <?   
             $SQL="SELECT * FROM Netsys_Product_Class order by ClassOrder Asc";
             $query=mysql_query($SQL);
			 $num=mysql_num_rows($query);
			 if($num!=0){
             while($ro=mysql_fetch_array($query)){
        ?>
                <option value="<? echo $ro['ClassID'];?>"<? if($ro['ClassID']==$row['ClassID']){echo "selected"; }?>><? echo $ro['ClassName'];?></option>
                <?
		}
		?>
                <?
  }
  else
  {
?>
                <option value="暂无分类">暂无分类</option>
                <?
}
?>
              </select>
                <font color="#ff0000">*</font></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">详细：</td>
            <td align="left" class="Right_td"><textarea id="NContent" name="NContent" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;" ><?php echo htmlspecialchars($htmlData); ?><? echo $row['NContent']; ?></textarea>            </td>
          </tr>
          <tr>
            <td align="left" class="Left_td">特殊标记：</td>
            <td align="left" class="Right_td"><input name="NHome" type="checkbox" id="NHome" value="1" 
			<?
			if($row['NHome']){
			echo "checked";
			}
			?>
			 style="border:none;" />
              新品推荐 </td>
          </tr>
          <tr>
            <td align="left" class="Left_td">&nbsp;</td>
            <td align="left" class="Right_td"><input name="submit" type="submit" onClick="return Check();" value=" 确认提交 " class="button">
              &nbsp;&nbsp;&nbsp;&nbsp;
              <input name="reset" type="reset" value=" 重新填写 " class="button">
              &nbsp;&nbsp;&nbsp;&nbsp;
              <input type="hidden" name="Edit" value="OK">
              <input type="hidden" name="NID" value="<? echo $row['NID']; ?>">            </td>
          </tr>
        </table>
        </form>
      </td>
    </tr>
</table>
<?
}
?>
</body>
</html>